/**
 *
 */
package cn.dw.dg.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.dw.dg.aop.Log;
import cn.dw.dg.model.Role;
import cn.dw.dg.service.RoleService;
import lombok.extern.slf4j.Slf4j;

/**
 * @author aubrey
 * @date  下午3:25:43
 * 
 */
@Controller
@RequestMapping("/role")
@Slf4j
@Log
public class RoleController {
	
	@Autowired
	private RoleService roleService;
	
	
	@RequestMapping("/add")
	@ResponseBody
	public String add(Role role) {
		log.info("正在执行新增=====================");
		roleService.add(role);
		return "{\"result\":\"success\"}";
		
	};
	
	
	@Log
	@RequestMapping("/update")
	@ResponseBody
	public String update(Role role) {
		log.info("正在执行更新=====================");
		roleService.update(role);
		return "success";
	};
	
	@RequestMapping("/select")
	@ResponseBody
	public String  select(Role role){
		List<Role> lists = roleService.select(role);
		return lists.toString();
		
	};
	
	@RequestMapping("/delete")
	@ResponseBody
	public String delete(Role role) {
		roleService.delete(role);
		return "success";
		
	};
}
